#include "Stats.h"

bool Stats::initialized = false;
Stats* Stats::_instance = NULL;

Stats* Stats::instance(){
	if (!initialized){
		_instance = new Stats();
		initialized = true;
		return _instance;
	}
	else{
		return _instance;
	}
}

Stats::Stats(){
	boxTests = 0;
	primInts = 0;
	primTests = 0;
}


Stats::~Stats(){
	initialized = false;
}



void Stats::boxTest(){
	boxTests++;
}
int Stats::boxTestCount(){
	return boxTests;
}

void Stats::primTest(){
	primTests++;
}
int Stats::primTestCount(){
	return primTests;
}

void Stats::primInt(){
	primInts++;
}
int Stats::primIntCount(){
	return primInts;
}

void Stats::toString(){
	printf("Ray-box intersection tests: %d\n", boxTests);
	printf("Ray-primitive intersection tests: %d\n", primTests);
	printf("Ray-primitive intersections: %d\n", primInts);
}
